package com.star.percalservice.controller;

import com.star.percalservice.model.dto.ResearchProjectDTO;
import com.star.percalservice.model.entity.ResearchProject;
import com.star.percalservice.service.ResearchProjectService;
import com.star.percalservice.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author star
 * @version 1.0
 * @Description:
 * @DateTime 2025/4/13 3:42
 */
@RestController
@RequestMapping("/api/project")
public class ResearchProjectController {

    @Autowired
    private ResearchProjectService researchProjectService;

    @PostMapping("/list")
    public R list(@RequestBody ResearchProjectDTO researchProjectDTO) {
        return researchProjectService.list(researchProjectDTO);
    }

    @PostMapping("/add")
    public R add(@RequestBody ResearchProject researchProject) {
        return researchProjectService.add(researchProject);
    }

    @PostMapping("/update")
    public R update(@RequestBody ResearchProject researchProject) {
        return researchProjectService.update(researchProject);
    }

    @PostMapping("/delete")
    public R delete(Integer id) {
        return researchProjectService.delete(id);
    }


}
